FROM php:7.3.7-fpm

MAINTAINER caspar <li-caspar@hotmail.com>

#使用国内源
#RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
#    echo "deb http://mirrors.163.com/debian/ jessie main non-free contrib" >/etc/apt/sources.list && \
#    echo "deb http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list && \
#    echo "deb-src http://mirrors.163.com/debian/ jessie main non-free contrib" >>/etc/apt/sources.list && \
#    echo "deb-src http://mirrors.163.com/debian/ jessie-proposed-updates main non-free contrib" >>/etc/apt/sources.list
RUN sed -i 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/mirrors.163.com\/ubuntu\//g' /etc/apt/sources.list


RUN apt-get update \
 && pecl install redis-4.0.1 \
 && rm /etc/apt/preferences.d/no-debian-php \
 && apt-get install -y \
  supervisor \
  cron \
  procps \
  vim \
  zlib1g-dev \
  libzip-dev \
  zip unzip \
  libfreetype6-dev \
  libmcrypt-dev \
  libjpeg62-turbo-dev \
  apt-transport-https \
  libpng-dev \
  libssl-dev \
  libmagickwand-dev \
  libmagickcore-dev \
  gifsicle \
  php-soap \
   && pecl install imagick \
  && docker-php-ext-enable redis \
  && docker-php-ext-enable imagick \
 && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
 && docker-php-ext-install -j$(nproc) pdo_mysql mysqli zip gd bcmath mbstring opcache soap \
 && rm -rf /var/lib/apt/lists/*;

COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["php-fpm"]